package cn.avalon.order.listener;

import org.apache.rocketmq.client.producer.SendResult;
import org.apache.rocketmq.spring.core.RocketMQTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.messaging.support.MessageBuilder;

/**
 * @description: 延迟同步
 * @author: Avalon
 * @date: 2022年09月15日 ： 21:28
 * @version: ver1.0
 * @email 709785494@qq.com
 */
public class DelayProduce {

    @Autowired
    private RocketMQTemplate rocketMQTemplatet;

    public void sendDelayMessage(String topic,String message,int delayLevel){
        SendResult sendResult = rocketMQTemplatet.syncSend(topic, MessageBuilder.withPayload(message).build(), 2000, delayLevel);
    }
}
